﻿@model LookupTableRowModel
@using (Ajax.BeginForm("SaveLookupTableRow", "LookupTables", new AjaxOptions()
{
    InsertionMode = InsertionMode.Replace, 
    UpdateTargetId = "middle-center",
    OnSuccess = "LookupRowAdded"
}))
{
    @Html.HiddenFor(p => p.RowId)
    @Html.HiddenFor(p => p.TableId)
    @Html.HiddenFor(p => p.TableName)
    @Html.HiddenFor(p => p.Active)
    @Html.HiddenFor(p => p.EffectiveDate)
    @Html.HiddenFor(p => p.ChangeId)

    <table>
    @*foreach (var value in Model.Values)*@
    @foreach(var item in Model.ItemValues)
    {
        @*<div>*@
        <tr>
            <td>@item.Key</td>
            <td>
                @if (new[] {"Id", "Sequence", "ChangeId", "EffectiveDate", "ExpirationDate", "Active", "IsOverride"}.Contains(item.Key))
                {
                    <input name="Values" readonly="readonly" value="@item.Value" />
                }
                else
                {
                    <input name="Values" value="@item.Value"/>
                }
            </td>
        </tr>
            
            
        @*</div>*@
    }
    </table>
    <input type="submit" value="Save" />
}